<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Person(name,age){
            this.name = name;
            this.age = age;
        }

        Person.prototype.sayHello = function(){
            console.log('hello world 999999999999999999');
        }


        // class 类名 extends 父类名{
        // super(参数) 继承父类的属性
        // 子类可以拥有自己的属性 
        // }

        class Student extends Person{
            // super(参数) 需要写在constructor中 
            constructor(gender,...args){
                // 继承父类的属性
                super(...args);
                this.gender = gender;
            }

            study(){
                console.log('好好学习,天天向上');
            }
        }

        const s1 = new Student('男','张三',18);
        console.log(s1);
        console.log(s1.name);
        console.log(s1.age);
        console.log(s1.gender);
        s1.sayHello()

    </script>
</body>
</html>